package com.panshi.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.Data;


@Data
@ApiModel(value = "分页实体类")
public class PagingVO<T>{

	@ApiModelProperty(value = "总记录数")
	private int total;

	@ApiModelProperty(value = "当前分页的数据列表")
	private T rows;

	@ApiModelProperty(value = "分页大小")
	private int pageSize;

	@ApiModelProperty(value = "当前页")
	private int currentPage;

	@ApiModelProperty(value = "起始页")
	private int beginNum;
	
	@ApiOperation(value = "获取当前查询页的起始下标 (limit)")
	public int getStartNum() {
		if(currentPage == 0) {
			return 0;
		}else {
			return pageSize * (currentPage-1);
		}
	}

	
	
}
